import tkinter as tk

class MyWindow():
    def __init__(self,app):
        self.app = app
        self.app.title("Hello tkinter!")

        self.isCheck1 = tk.BooleanVar()
        self.isCheck2 = tk.BooleanVar()

        self.ck1 = tk.Checkbutton(self.app,text="苹果",variable=self.isCheck1,command=self.show_check_info)
        self.ck1.pack()

        self.ck2 = tk.Checkbutton(self.app, text="香蕉", variable=self.isCheck2,command=self.show_check_info)
        self.ck2.pack()

    def show_check_info(self):
        print(self.isCheck1.get(),self.isCheck2.get())

if __name__ == '__main__':
    app = tk.Tk()
    window = MyWindow(app)
    app.mainloop()